package org.jash.ting13.home

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import com.youth.banner.adapter.BannerAdapter
import org.jash.ting13.BR
import org.jash.ting13.R
import org.jash.ting13.entity.SliderEntity
import org.jash.utils.CommonViewHolder
import org.jash.utils.log

class HomeAdapter(datas:List<SliderEntity>):BannerAdapter<SliderEntity, CommonViewHolder>(datas) {
    override fun onCreateHolder(parent: ViewGroup, viewType: Int): CommonViewHolder =
        CommonViewHolder(DataBindingUtil.inflate(LayoutInflater.from(parent.context), R.layout.item_slider, parent, false))

    override fun onBindView(
        holder: CommonViewHolder,
        data: SliderEntity,
        position: Int,
        size: Int
    ) {
        holder.binding.setVariable(BR.slider, data)
    }
}
